/**
 * Created by apple on 16/11/9.
 */
var React = require('react');

var Contacts = require('./contacts.js');
var MainVideo = require('./main_video.js');
var Calling = require('./calling.js');


var Main = React.createClass({
    getInitialState:function () {
      return {
          persons:this.props.contacts,
          calling:false
      }
    },
    callFun:function () {
        this.setState({
            calling:true
        })
    },

    render:function () {
        if(this.state.calling){//正在呼叫
            return (<div><Calling /><MainVideo /></div>);
        }else{
            return (<div className="main"><Contacts  contacts={this.state.persons} oncalling={this.callFun} /><MainVideo /></div>);
        }

    }
})

module.exports = Main;